import locale from './locale'

const list = []
const messages = {}

void locale.forEach(lang => {
  list.push({ code: lang.name, name: lang.language })
  messages[lang.name] = lang
})

export const appendLocale = (name, locale) => {
  for (const key in locale) {
    messages[key][name] = locale[key]
  }
}

export default { messages, list }